using System;
using System.Collections.Generic;
using System.Text;
using Presentation.Contracts;
using Task.Contracts;
using DataAccess;
using Globals;
using Task;
using System.Data;

namespace Presentation
{
   public class InboxPresenter
    {

        #region Members

        /// <summary>
        /// Instance of view.
        /// </summary>
        private IInboxView view;

        /// <summary>
        /// Simple task.
        /// </summary>
        private IMessageTask task;

        #endregion Members

        #region Construction/Finalization

        /// <summary>
        /// Initializes a new instance of the <see cref="AddForumPresenter"/> class.
        /// </summary>
        /// <param name="view">The view.</param>
        public InboxPresenter(IInboxView view)
        {
            this.view = view;
            task = new MessageTask();
        }

        #endregion Construction/Finalization

                     
        #region Public Methods

       public int GetNumberOfReceivedMessages()
       {
           return task.GetNumberOfReceivedMessages(int.Parse(view.SessionID()));
       }

       public void GetAllReceivedMsg()
       {
           DataTable dt = task.GetAllReceivedMessages(int.Parse(view.SessionID()));
           view.ShowMessages(dt);
       }

       public string GetStatOfMessage(int MsgId)
       {
           return task.GetStatusOfMessage(MsgId);
       }

       public void DelMessage(int MsgId)
       {
           task.DeleteMessage(MsgId);
       }

       public void SetCaption()
       {
           view.SetHeader();
       }

        #endregion Public Methods

    }
}
